<template>
  <div>
    <el-form
      :ref="formItem.formRef"
      :model="formData"
      :label-width="formItem.labelWidth"
      :class="formItem.formClass"
      :size="formItem.formSize"
      :label-position="formItem.labelPosition"
    >
      <el-row :gutter="24">
        <el-col
          v-for="(item, index) in formItem.allItem"
          :key="index"
          :span="item.span"
        >
          <el-form-item :label="item.label" :prop="item.prop">
            <!-- 输入框 -->
            <el-input
              v-if="item.type == 'input'"
              v-model="formData[item.prop]"
              :disabled="item.disabled"
              :placeholder="item.placeholder"
              :clearable="item.clearable"
            ></el-input>
            <!-- radio单选框 -->
            <el-radio-group
              v-if="item.type == 'radio'"
              v-model="formData[item.prop]"
              :disabled="item.disabled"
            >
              <el-radio
                v-for="(options, rIndex) in item.options"
                size="large"
                :key="rIndex"
                :value="options.value"
              >
                <div class="text color1">{{ options.label }}</div>
              </el-radio>
            </el-radio-group>
            <!-- textarea输入框 -->
            <el-input
              v-if="item.type == 'textarea'"
              v-model="formData[item.prop]"
              size="small"
              type="textarea"
              :rows="formObj.rows"
              :disabled="item.disabled"
              :placeholder="item.placeholder"
            />
            <el-date-picker
              v-if="item.type == 'date'"
              v-model="formData[item.prop]"
              type="date"
              :disabled="item.disabled"
              :placeholder="item.placeholder"
              size="default"
            />
            <el-select
              v-if="item.type == 'select'"
              v-model="formData[item.prop]"
              :placeholder="item.placeholder"
              :disabled="item.disabled"
            >
              <el-option
                v-for="item in item.options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>

            <span v-if="item.type == 'text'" v-text="formData[item.prop]" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script setup>
const props = defineProps({
  formItem: {
    type: Object,
    default: {},
  },
  formData: {
    type: Object,
    default: () => {
      return {};
    },
  },
});
</script>

<style lang="scss" scoped>
:deep(.el-radio.el-radio--large .el-radio__label) {
  height: 20px;
  line-height: 10px;
  font-size: 14px;
  background: rgb(245, 154, 35);
  padding: 5px 20px;
  margin-left: 5px;
  border-radius: 4px;
  color: #fff;
}
:deep(.el-form) {
  max-width: 100% !important;
  padding-left: 20px;
}
:deep(.el-step.is-vertical .el-step__line) {
  bottom: -25px;
  left: 11px;
  top: 15px;
  width: 2px;
}
.btn {
  width: 30px;
  height: 30px;
  margin-left: 10px;
}
.tooltipText {
  padding: 5px;
  .textOne {
    font-size: 15px;
  }
  .textTwo {
    font-size: 14px;
    color: rgb(97, 97, 97);
    margin-top: 5px;
  }
}
.tag {
  margin-left: 10px;
}

.bottom-btns {
  position: fixed;
  bottom: 0;
  width: 100%;
  border-left: 2px solid rgb(230, 230, 230);
  background: #fff;
  z-index: 10;
  right: 0;
  .btns {
    height: 64px;
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #e6e6e6;
    position: relative;
    .btnList {
      display: inline-block;
    }
    .back-btn {
      display: inline-block;
      margin-left: 16px;
      .el-button {
        border-radius: 4px !important;
      }
    }
    button {
      padding: 0px 24px;
      line-height: 32px;
    }
  }
}
</style>
<style lang="scss">
// 提示气泡
.successTip.el-popper.is-dark {
  background-color: rgb(151, 250, 102);
  border: 1px solid rgb(151, 250, 102);
  color: #000;
}
// 三角形颜色
.successTip.el-popper.is-dark .el-popper__arrow:before {
  background-color: rgb(151, 250, 102);
  border: 1px solid rgb(151, 250, 102);
}
// 提示气泡
.warningTip.el-popper.is-dark {
  background-color: rgb(255, 232, 117);
  border: 1px solid rgb(255, 232, 117);
  color: #000;
}
// 三角形颜色
.warningTip.el-popper.is-dark .el-popper__arrow:before {
  background-color: rgb(255, 232, 117);
  border: 1px solid rgb(255, 232, 117);
}
</style>
